package com.hyf.meterialdesign.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.hyf.meterialdesign.fragment.SimpleFragment;

import java.util.List;

/**
 * Created by HeYongFeng on 2017/4/7.
 */

public class SimpleFragmentAdaptper extends FragmentPagerAdapter {
    private List<SimpleFragment> fragmentList;
    private String[] tities;


    public SimpleFragmentAdaptper(FragmentManager fm,List<SimpleFragment> fragmentList,String[] tities) {
        super(fm);
        this.fragmentList = fragmentList;
        this.tities = tities;
    }

    public SimpleFragmentAdaptper(FragmentManager fm,List<SimpleFragment> fragmentList) {
        super(fm);
        this.fragmentList = fragmentList;
    }

    @Override
    public Fragment getItem(int position) {
        return fragmentList.get(position);
    }

    @Override
    public int getCount() {
        return fragmentList.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return tities[position];
    }
}
